package homework;

import java.util.Scanner;

public class Vip {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入四位会员号：");
        int vipnum = sc.nextInt();
        boolean vipId=vipnum>1000&&vipnum<=9999;
        if(vipId) {
            int a = vipnum % 10;
            int b = vipnum % 100 / 10;
            int c = vipnum % 1000 / 100;
            int d = vipnum % 10000 / 1000;
            if ((a + b + c + d) > 16 && (a + b + c + d) < 20) {
                System.out.println("获得餐巾纸一包");
            } else if ((a + b + c + d) >= 20 && (a + b + c + d) < 24) {
                System.out.println("获得电吹风一部");
            } else if ((a + b + c + d) >= 26) {
                System.out.println("获得彩电一台");
            }
        }else{
            System.out.println("会员号不合法");
        }
    }
}
